<?php
session_start();
if(!@$_SESSION['username']) {
  echo "<script>window.location.href='login.php';</script>";
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/font-awesome/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]>
<link href="lib/font-awesome/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>$
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>添加车站</title>
</head>
<body>

<?php
  //获取全部数据
  include_once('libraries/esaydb.class.php');
  $db = new EasyDB();
  if(@$_GET['sid']) {
    $sql = "SELECT * FROM ob_station AS a LEFT OUTER JOIN ob_ticket AS b ON a.sid = b.sid WHERE a.sid = ?";
    $result = $db->queryAll($sql, array($_GET['sid']));
    // var_dump($result);echo $result[1]['price'];
  }else{
    $result = null;
  }
?>
<div class="pd-20">
  <form action="modules/admin/stationAdd.php" method="post" class="form form-horizontal" id="form-user-add">
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>列车编号：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="<?php if($result) echo $result[0]['sid'] ?> " placeholder="" id="user-name" name="station-num"  nullmsg="列车编号不能为空">
      </div>
      <div class="col-4"></div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>出发地：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="<?php if($result) echo $result[0]['station_start'] ?> " placeholder="" id="user-tel" name="user-from"   nullmsg="出发地不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>目的地：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="<?php if($result) echo $result[0]['station_end'] ?> " placeholder="" id="user-tel" name="user-to"  nullmsg="目的地不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>出发时间：</label>
      <div class="formControls col-5">
        <input onfocus="WdatePicker({Date:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}'})" type="text" class="input-text" value="<?php if($result) echo $result[0]['time_start'] ?> " placeholder="" id="user-tel" name="time-from"   nullmsg="出发时间不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>预计到达时间：</label>
      <div class="formControls col-5">
        <input onfocus="WdatePicker({Date:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}'})" type="text" class="input-text" value="<?php if($result) echo $result[0]['time_end'] ?> " placeholder="" id="user-tel" name="time-to"  nullmsg="预计到达时间不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>座位数目和价格（有座）：</label>
      <div class="formControls col-2">
        <input type="text" class="input-text" value="<?php if($result) echo $result[0]['number'] ?> " placeholder="" id="user-tel" name="have"  nullmsg="座位数不能为空">
      </div>
      <div class="formControls col-2">
        <input type="text" class="input-text" value="<?php if($result) echo $result[0]['price'] ?>" placeholder="" id="user-tel" name="have-p"  nullmsg="座位数不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>座位数目和价格（无座）：</label>
      <div class="formControls col-2">
        <input type="text" class="input-text" value="<?php if($result) echo $result[0]['num_none'] ?> " placeholder="" id="user-tel" name="none" nullmsg="座位数不能为空">
      </div>
       <div class="formControls col-2">
        <input type="text" class="input-text" value=" <?php if($result) echo @$result[1]['price']; else echo 0;?>" placeholder="" id="user-tel" name="none-p" nullmsg="座位数不能为空">
      </div>
      <div class="col-4"> </div>
    </div>

    <input type="hidden" name="sid" value="<?php echo $_GET['sid']; ?>" />
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
      </div>
    </div>
  </form>
</div>
</div>
<script type="text/javascript" src="lib/jquery.min.js"></script>
<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="lib/Validform_v5.3.2.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script>
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
$(function(){
	$("#form-user-add").Validform({
		tiptype:2,
	});
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
});
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?080836300300be57b7f34f4b3e97d911";
  var s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(hm, s);
})();
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F080836300300be57b7f34f4b3e97d911' type='text/javascript'%3E%3C/script%3E"));
</script>
</body>
</html>